package coms.ejb.sessionbean;

import java.util.List;

import javax.ejb.Remote;
import javax.ejb.Stateful;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionManagement;

import coms.dataaccess.ConferenceDAO;
import coms.dataaccess.DAOFactory;
import coms.dataaccess.TransactionDAO;
import coms.datatransfer.TransactionDTO;



@Stateful(name = "PaymentBean", mappedName = "PaymentBean")
@Remote(PaymentBeanRemote.class)
@TransactionManagement(javax.ejb.TransactionManagementType.CONTAINER)
public class PaymentBean implements PaymentBeanRemote {


	private TransactionDAO transactionDAO = null;
	private ConferenceDAO conferenceDAO = null;
	
	public void initialize(){
		transactionDAO = DAOFactory.getInstance().getTransactionDAO();
		conferenceDAO = DAOFactory.getInstance().getConferenceDAO();
		transactionDAO.initialize();
	}

	@TransactionAttribute(javax.ejb.TransactionAttributeType.NOT_SUPPORTED)
	@Override
	public TransactionDTO makePayment(TransactionDTO transaction) {
		return transactionDAO.makePayment(transaction);
	}

	@Override
	public List<TransactionDTO> getAllTransactions(int ConferenceItemID,
			int userID) {
		// TODO Auto-generated method stub
		
		System.out.println("ConferenceItem Id in Bean"+ConferenceItemID+""+userID);
		
		
		return transactionDAO.getAllTransactions(ConferenceItemID, userID);
	}
	


}
